package com.tpc.yaoxpt.job;


import com.tpc.yaoxpt.schedule.BusinessScheduleService;
import javafx.concurrent.ScheduledService;
import javafx.util.Duration;

import java.util.concurrent.Executors;

public class BusinessJob {

    ScheduledService<Void> businessSchedule = null;

    public void execScheduledService(){
        BusinessScheduleService businessScheduleService = new BusinessScheduleService();
        businessScheduleService.setExecutor(Executors.newFixedThreadPool(1));
        businessScheduleService.setDelay(Duration.millis(1000));
        businessScheduleService.setPeriod(Duration.millis(60000));
        businessScheduleService.restart();
        businessSchedule = businessScheduleService;
    }

    public void stopScheduledService(){
        businessSchedule.cancel();
    }
}
